﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace MMSWebsite.Models
{
    public class Person
    {
        [HiddenInput]
        public int Id { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Code")]
        [StringLength(5, ErrorMessage = "Must be 5 characters")]
        public string Code { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Name")]
        public string Name { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "ID Code")]
        public string IdCode { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Email")]
        //[DataType(DataType.EmailAddress)]
        [RegularExpression("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$", ErrorMessage = "Email is invalid")]
        public string Email { get; set; }

        [Display(Name = "Phone")]
        [DataType(DataType.PhoneNumber)]
        public string Phone { get; set; }

        [Display(Name = "Sex")]
        public Boolean? Sex { get; set; }

        [Display(Name = "Birthday")]
        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime? Birth { get; set; }

        [Display(Name = "Number Address")]
        public string NumberAddress { get; set; }

        [Required(ErrorMessage = "*")]
        [Display(Name = "Area")]
        public MMS_AREA Area { get; set; }

    }
}